package com.qiaoanju.controller;

import com.qiaoanju.domain.UserDomain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/user")
public class UserConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/movie/{id}")
    public UserDomain findById(@PathVariable Long id) {
        return this.restTemplate.getForObject("http://qiaoanju-microsofts-eureka-client-provider/simple/" + id, UserDomain.class);
    }
}
